<include file="Layout/header" />
<div class="mws-panel grid_8">
    <div class="mws-panel-header">
        <span><i class="icon-table"></i> 管理列表</span>
    </div>
    <form method="post" action="{:U('Admin/User/lists')}">
        <div class="mws-panel-body no-padding">
            <div id="DataTables_Table_1_wrapper" class="dataTables_wrapper" role="grid">
                <div id="DataTables_Table_1_length" class="dataTables_length">
                    <label>根据&nbsp;
                        <select  name="seek_type" >
                            <option value="nikename"  {$res['seek_type'] == 'nikename'  ? 'selected ':''}>姓名</option>
                            <option value="username" {$res['seek_type'] == 'username' ? 'selected ':''}>用户名</option>
                            
                            <option value="phone" {$res['seek_type'] == 'phone' ? 'selected':''}>电话</option>
                            <option value="email" {$res['seek_type'] =='email'? 'selected':''}>邮箱</option>
                        </select> 查询
                    </label>
                </div>
                <div class="dataTables_filter" id="DataTables_Table_1_filter">
                    <label>关键字<input type="text" name="keyword" value="{$res['keyword']}" aria-controls="DataTables_Table_1">
                    </label>
                    <button  class="btn btn-primary">确定</button>
                </div>

                </form>

                <table class="mws-datatable-fn mws-table">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>用户名</th>
                            <th>姓名</th>
                            <th>性别</th>
                            <th>电话</th>
                            <th>邮箱</th>
                            <th>添加时间</th>
                            <th>登陆时间</th>
                            <th>删除时间</th>
                            <th style="width:120px;">操作</th>
                        </tr>
                    </thead>

                    <tbody>
                    <foreach name="data" item="v">
                        <tr >
                            
                            <td>{$v['id']}</td>
                            <td>{$v['username']}</td>
                            <td>{$v['nikename']}</td>
                            <td>{$v['sex']}</td>
                            <td>{$v['phone']}</td>
                            <td>{$v['email']}</td>
                            <td>{$v['add_time']}</td>
                            <td>{$v['login_time']}</td>
                            <td>{$v['delete_time']}</td>
                            <td><a href="javascript:;" class="btn btn-primary" onclick="edit({$v['id']})">修改</a>&nbsp;&nbsp;
                            <a href="javascript:;" class="btn btn-danger" onclick="destroy({$v['id']})">删除</a></td>
                        </tr>
                    </foreach>
                    <script type="text/javascript">
                       //修改管理员信息
                       function edit(id){
                            layer.open({

                              type: 2,
                              area: ['1000px', '650px'],
                              fixed: false, //不固定
                              title :false,
                              maxmin: true,
                              content: '{:U('Admin/User/edit')}&id='+id
                            });
                       }


                        //点击删除管理员
                        function destroy(id)
                        {
                            layer.confirm('您是确定要删除？', {
                              btn: ['删除','取消'] //按钮
                            }, function(){
                                $.ajax({
                                    url: '/index.php?m=Admin&c=User&a=destroy&id='+id,
                                    type: 'GET',
                                    dataType: 'json',
                                    data: {'id': id},
                                    success:function(data){
                                        if (data == 200) {
                                            layer.msg('删除成功', {icon: 1});
                                            window.location.replace('{:U('Admin/User/lists')}');
                                        } else {
                                            layer.msg('删除失败', {icon: 5});
                                        }
                                    }
                                })
                               
                              
                            });
                                                       
                        } 
                       
                    </script>
                    </tbody>
                </table>
                <style type="text/css">
                    div.meneame{padding:3px;font-size:80%;margin:3px;color:#fff;text-align:center;}
                    div.meneame a{border:#fff 1px solid;padding:5px 7px;background-position:50% bottom;margin:0 3px 0 0;text-decoration:none;}
                    div.meneame a:hover{border:#ff9600 1px solid;background-image:none;color:#ff6500;background-color:#ffc794;}
                    div.meneame a:active{border:#ff9600 1px solid;background-image:none;color:#ff6500;background-color:#ffc794;}
                    div.meneame span.current{border:#fff 1px solid;padding:5px 7px;font-weight:bold;color:#ff6500;margin:0 3px 0 0;background-color:#fff;}
                    div.meneame span.disabled{border:#ffe3c6 1px solid;padding:5px 7px;color:#ffe3c6;margin:0 3px 0 0;}

                </style>
                <div class="meneame">
                    {$show}
                </div>

            </div>
        </div>
</div>
<include file="Layout/footer" />
